package Fangfalianxi;

import java.util.Scanner;

//飞机票
//需求：机票价格按照淡季旺季、头等舱和经济舱收费、输入机票原价、月份和头等舱或经济舱。
//旺季（5-10月）头等舱9折，经济舱8.5折，淡季（11月到来年4月）头等舱7折，经济舱6.5折。
public class test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入机票的原价：");
        int ticket = sc.nextInt();
        System.out.println("请输入舱位（0：头等舱 1：经济舱）：");
        int seat = sc.nextInt();
        System.out.println("请输入当前月份：");
        int month = sc.nextInt();
            if(month >=5 && month <= 10){
                ticket = getPrice(ticket,seat,0.9,0.85);
                System.out.println("打完折后的票价为："+ticket);
            }else if((month >=11 && month <=12) || (month >= 1 && month <=4)){
                ticket = getPrice(ticket,seat,0.7,0.65);
                System.out.println("打完折后的票价为："+ticket);
            }else{
                System.out.println("输入月份不对");
            }
        }

    public static int getPrice(int ticket,int seat,double v1,double v2){
      if(seat==0){
          ticket = (int)(ticket*v1);
      }else if(seat==1){
          ticket = (int)(ticket*v2);
      }else{
          System.out.println("输入的舱位有误");
      }
      return ticket;
    }
}
